package com.sig.sigandroidDisconnected;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.widget.Toast;

import com.sig.load.LoadAllElements;
import com.sig.sigandroid.R;

public class DisconnectedActivity extends Activity {
	
	private CarteGLSufaceView mySurfaceView;
	private LoadAllElements allgraphics;
	DetectLocation locationListener;
	@SuppressLint("ShowToast")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_carte);
		
		LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locationListener = new DetectLocation(); // TODO
        lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,
                        locationListener);
		
		
		
		allgraphics=FirstActivity.getGraphics();
		mySurfaceView=new CarteGLSufaceView(this,allgraphics,locationListener);		
		//Log.d("Ok", "it's ok no error "+allgraphics.getAllSegments().size());
		setContentView(mySurfaceView);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.carte, menu);
		return true;
	}
	
	@Override
	protected void onPause() {
		super.onPause();
		mySurfaceView.onPause();
	}

	@Override
	protected void onResume() {
		super.onResume();
		mySurfaceView.onResume();
	}
	

	public class DetectLocation implements LocationListener {

		public double getLatitude() {
			return 47.84326d;
		}

		public double getLongitude() {
			return 1.9264938d;
		}

		@Override
		public void onLocationChanged(Location arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void onProviderDisabled(String arg0) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void onProviderEnabled(String provider) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void onStatusChanged(String provider, int status, Bundle extras) {
			// TODO Auto-generated method stub
			
		}

	}
}
